<extend name="Layout/ins_page" />
<block name="content">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Form</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
        <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    </head>
    <style>

        td{
            margin-top:10px;

        }
    </style>
    <body>

    <div>
        起始时间:<input property="" class="mini-datepicker" valueType='string' style="width:200px;" format="yyyy-MM-dd" id='timeTagStart' value=""  />
        结束时间:<input property="" class="mini-datepicker" valueType='string' style="width:200px;" format="yyyy-MM-dd" id='timeTagComplete' value=""  />
    </div>

    <div>
        <a href="javascript:openmaoli()">毛利报表</a> <a href="javascript:exportmaoli()">导出Excel</a>
    </div>

    <div>
        <a href="javascript:openxiaoshou()">销售报表</a> <a href="javascript:exportxiaoshou()">导出Excel</a>
    </div>

    <div>
        <a href="javascript:opencaigou()">采购报表</a> <a href="javascript:exportcaigou()">导出Excel</a>
    </div>

    </body>
    </html>
</block>
<block name="js">
    <script type="text/javascript">

        function openmaoli(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            mini.open({
                url:  "/SapSupplier/permissionmaoli/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete,
                title: "毛利报表",
                width: 800,
                height: 600,
                ondestroy: function (action) {
                    if (action == "ok") {
                    }
                }
            });
        }

        function exportmaoli(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            this.location.href="/SapSupplier/permissionmaoliexcel/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete;
        }

        function openxiaoshou(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            mini.open({
                url:  "/SapSupplier/permissionxiaoshou/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete,
                title: "销售报表",
                width: 800,
                height: 600,
                ondestroy: function (action) {
                    if (action == "ok") {
                    }
                }
            });
        }

        function exportxiaoshou(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            this.location.href="/SapSupplier/permissionxiaoshouexcel/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete;
        }

        function opencaigou(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            mini.open({
                url:  "/SapSupplier/permissioncaigou/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete,
                title: "采购报表",
                width: 800,
                height: 600,
                ondestroy: function (action) {
                    if (action == "ok") {
                    }
                }
            });
        }

        function exportcaigou(e) {
            var btnEdit = this;
            var timeTagStart = mini.get('timeTagStart').getValue();
            var timeTagComplete = mini.get('timeTagComplete').getValue();
            if(!timeTagStart){
                alert('起始时间必选！');
                exit;
            }
            if(!timeTagComplete){
                alert('结束时间必选！');
                exit;
            }
            if(timeTagStart>timeTagComplete)
            {
                alert('时间范围错误！');
                exit;
            }
            this.location.href="/SapSupplier/permissioncaigouexcel/timeTagStart/"+timeTagStart+"/timeTagComplete/"+timeTagComplete;
        }

    </script>
</block>
